#! /bin/bash
cd /home
docker build -t java:euraka .

docker tag java:euraka 192.168.19.132:5000/java:euraka
rm -rf /home/Sping-Cloud-eureka-Server-0.0.1-SNAPSHOT.jar
rm -rf /home/Dockerfile
docker kill  euraka1 euraka2 euraka3
docker rm  euraka1 euraka2 euraka3
#删除停止的容器
#docker rm $(docker ps --all -q -f status=exited)

#删除没有使用的镜像
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")
docker run -it -d --name euraka1 -p 8761:8761 java:euraka  java -jar /usr/src/myapp/Sping-Cloud-eureka-Server-0.0.1-SNAPSHOT.jar --Spring.profiles.active=discovery1
docker run -it -d --name euraka2 -p 8762:8762 java:euraka  java -jar /usr/src/myapp/Sping-Cloud-eureka-Server-0.0.1-SNAPSHOT.jar --Spring.profiles.active=discovery2
docker run -it -d --name euraka3 -p 8763:8763 java:euraka  java -jar /usr/src/myapp/Sping-Cloud-eureka-Server-0.0.1-SNAPSHOT.jar --Spring.profiles.active=discovery3